<script lang="ts" setup>
  import { ref } from "vue";

  const dataList = ref<any>([
    {
      name: "产品运营",
      sort: "50",
    },
    {
      name: "全职",
      sort: "50",
    },
  ]);

  const modalVisible = ref(false);

  const handleAction = (action: string) => {
    if (action === "add") {
      modalVisible.value = true;
    }
  };
</script>

<template>
  <umrp-container :gap="16" bg-color="#f2f2f2" height="100%" padding="16px">
    <umrp-breadcrumb :items="['岗位管理', '岗位标签']"></umrp-breadcrumb>
    <umrp-card :border="false">
      <umrp-table :action-bar="true" :data="dataList" @action="handleAction">
        <template #columns>
          <umrp-table-column title="序号" data-index="id"></umrp-table-column>
          <umrp-table-column title="标签名称" data-index="name"></umrp-table-column>
          <umrp-table-column title="标签排序" data-index="sort"></umrp-table-column>
          <umrp-table-column slot-name="action" title="操作" :width="120"></umrp-table-column>
        </template>
        <template #action>
          <umrp-space :size="10">
            <umrp-button type="primary" @click="modalVisible = true">编辑</umrp-button>
            <umrp-popconfirm message="您确认删除么？">
              <umrp-button type="danger">删除</umrp-button>
            </umrp-popconfirm>
          </umrp-space>
        </template>
      </umrp-table>
    </umrp-card>
  </umrp-container>
  <umrp-modal width="500px" v-model:visible="modalVisible">
    <umrp-form>
      <umrp-form-item label="分类名称">
        <umrp-input placeholder="请输入岗位名称"></umrp-input>
      </umrp-form-item>
      <umrp-form-item label="分类排序">
        <umrp-input-number placeholder="请输入分类排序"></umrp-input-number>
      </umrp-form-item>
    </umrp-form>
  </umrp-modal>
</template>
